# 存放Hermite元相关代码
# 基函数在Reference mesh [0, 1]上
def hermite_basis_functions(xi, h):
    phi1 = 1 - 3 * xi**2 + 2 * xi**3
    phi2 = h * (xi - 2 * xi**2 + xi**3)
    phi3 = 3 * xi**2 - 2 * xi**3
    phi4 = h * (-xi**2 + xi**3)

    dphi1 = -6 * xi + 6 * xi**2
    dphi2 = h * (1 - 4 * xi + 3 * xi**2)
    dphi3 = 6 * xi - 6 * xi**2
    dphi4 = h * (-2 * xi + 3 * xi**2)

    ddphi1 = -6 + 12 * xi
    ddphi2 = h * (-4 + 6 * xi)
    ddphi3 = 6 - 12 * xi
    ddphi4 = h * (-2 + 6 * xi)

    return [phi1, phi2, phi3, phi4], [dphi1, dphi2, dphi3, dphi4], [ddphi1, ddphi2, ddphi3, ddphi4]
